import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:icruxfe/index/LoginRegister.dart';

import 'InkWellTab.dart';
import 'SearchInputTxt.dart';

// import 'package:toutiao/tt/index/IndexTab.dart';
// import 'package:toutiao/tt/infolist/SearchTxt.dart';

class MyAppBar extends StatefulWidget {
  @override
  createState() => new MyAppBarState();
}

class MyAppBarState extends State<MyAppBar> {
  List<Tab> tabs;
  Border border;

  @override
  void dispose() {
    super.dispose();
  }

  @override
  void initState() {
    super.initState();
    tabs = [];
    border = Border(bottom: BorderSide.none);
    setState(() {
      tabs.add(Tab(text: "文章"));
      tabs.add(Tab(text: "问答"));
    });
  }

  void doTap(String type) {
    setState(() {
      print(type);
      border = Border(
          bottom: BorderSide(
        color: const Color(0xFF000000),
        width: 10.0,
        style: BorderStyle.solid,
      ));
    });
  }

  @override
  Widget build(BuildContext context) {
    Row row = new Row(
      children: [
        new Expanded(
            flex: 1,
            child: new Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                new Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: <Widget>[
                    SizedBox(
                        width: 50,
                        height: 50,
                        child: new Image.asset(
                          "images/logo.png",
                        )),
                    new Container(
                      width: 70,
                      // padding: const EdgeInsets.only(left: 5.0),
                      child: new Text(
                        "icrux",
                        textAlign: TextAlign.center,
                        style: new TextStyle(
                            color: Colors.white,
                            fontSize: 20,
                            fontWeight: FontWeight.bold),
                      ),
                    ),
                    new InkWellTab(
                        "文章", () => {Navigator.pushNamed(context, "/")}),
                    new InkWellTab("问答",
                        () => {Navigator.pushNamed(context, "/askIndex")}),
                    new InkWellTab("工具", () => {}),
                    new Container(
                        padding: const EdgeInsets.only(left: 10.0),
                        width: 300,
                        height: 40,
                        child: new SearchInputTxt())
                  ],
                ),
                new LoginRegister()
              ],
            )),
      ],
    );

    return new Container(
      child: row,
    );
  }
}
